package com.dili.dd.gpi.mapper;

import com.dili.dd.gpi.domain.Application;
import com.dili.dd.gpi.domain.ApplicationExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ApplicationMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table application
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int countByExample(ApplicationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table application
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int deleteByExample(ApplicationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table application
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    @Delete({
        "delete from application",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table application
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    @Insert({
        "insert into application (appkey, app_name, ",
        "username, platform_code, ",
        "category_code, `language`, ",
        "description, create_date)",
        "values (#{appkey,jdbcType=VARCHAR}, #{appName,jdbcType=VARCHAR}, ",
        "#{username,jdbcType=VARCHAR}, #{platformCode,jdbcType=VARCHAR}, ",
        "#{categoryCode,jdbcType=VARCHAR}, #{language,jdbcType=VARCHAR}, ",
        "#{description,jdbcType=VARCHAR}, #{createDate,jdbcType=DATE})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(Application record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table application
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int insertSelective(Application record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table application
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    List<Application> selectByExample(ApplicationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table application
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    @Select({
        "select",
        "id, appkey, app_name, username, platform_code, category_code, `language`, description, ",
        "create_date",
        "from application",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    Application selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table application
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int updateByExampleSelective(@Param("record") Application record, @Param("example") ApplicationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table application
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int updateByExample(@Param("record") Application record, @Param("example") ApplicationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table application
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int updateByPrimaryKeySelective(Application record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table application
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    @Update({
        "update application",
        "set appkey = #{appkey,jdbcType=VARCHAR},",
          "app_name = #{appName,jdbcType=VARCHAR},",
          "username = #{username,jdbcType=VARCHAR},",
          "platform_code = #{platformCode,jdbcType=VARCHAR},",
          "category_code = #{categoryCode,jdbcType=VARCHAR},",
          "`language` = #{language,jdbcType=VARCHAR},",
          "description = #{description,jdbcType=VARCHAR},",
          "create_date = #{createDate,jdbcType=DATE}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Application record);
}